
//
//  NetWorTools.swift
//  GWY_Menu
//
//  Created by x on 2017/8/17.
//  Copyright © 2017年n HLB. All rights reserved.
//

import UIKit

class NetWorTools: AFHTTPSessionManager {
    
    
    /// 创建一个网络工具类单利
    static let tools: NetWorTools = {
        let net = NetWorTools()
        //设置AFNetworking支持的数据类型
        net.responseSerializer.acceptableContentTypes = NSSet(objects: "application/json","text/json","text/javascript","text/plain","text/html") as? Set<String>
        //设置没有证书
        let securityPolicy = AFSecurityPolicy.default()
        //是否信任无效或过期SSL证书的服务器。默认为“false”
        securityPolicy.allowInvalidCertificates = true
        //是否验证证书CN字段中的域名。默认为“true”。
        securityPolicy.validatesDomainName = false
        //设置证书
        net.securityPolicy = securityPolicy
        
        return net
    }()
    

    class func shareNetWorkTools() ->NetWorTools {
        
        return tools
    }
}
